home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / StringArrayOption.java < prev    next >
Text File  |  1998-09-08  |  2KB  |  87 lines

  1. package com.symantec.itools.frameworks.application.commandline;
  2.  
  3.  
  4. /**
  5.  * @author Symantec Internet Tools Division
  6.  * @version 1.0
  7.  * @since VCafe 3.0
  8.  */
  9.  
  10. public abstract class StringArrayOption 
  11.     extends ArrayOption
  12. {
  13.     public StringArrayOption()
  14.     {
  15.     }
  16.  
  17.     public StringArrayOption(String[] flags)
  18.     {
  19.         super(flags);        
  20.     }
  21.  
  22.     public StringArrayOption(String[] flags, int count)
  23.     {
  24.         super(flags, count);
  25.     }
  26.  
  27.     /**
  28.      * @param args TODO
  29.      * @param startIndex TODO
  30.      * @since VCafe 3.0
  31.      */
  32.  
  33.     /*
  34.         args[ start_index ] will be the flag.
  35.         args[ start_index + 1 ] should be the first integer value
  36.     */
  37.     protected String[] getStringArray(String[] args, int startIndex)
  38.     {
  39.         String[] array;
  40.         
  41.         array = new String[count];
  42.         
  43.         for(int i = 0; i < count; i++)
  44.         {
  45.             array[i] = args[startIndex + i + 1];
  46.         }
  47.         
  48.         return (array);
  49.     }
  50.  
  51.     /**
  52.      * @param args TODO
  53.      * @param startIndex TODO
  54.      * @param count TODO
  55.      * @exception com.symantec.itools.frameworks.application.commandline.MissingArgumentsException
  56.      * @since VCafe 3.0
  57.      */
  58.  
  59.     /*
  60.         args[ start_index ] will be the flag.
  61.         args[ start_index + 1 ] should be the first integer value
  62.     */
  63.     protected String[] getStringArray(String[] args, int startIndex, int count)
  64.         throws MissingArgumentsException
  65.     {
  66.         String[] array;
  67.         
  68.         this.count = count;
  69.         array      = new String[count];
  70.     
  71.         try
  72.         {
  73.             for(int i = 0; i < count; i++)
  74.             {
  75.                 array[i] = args[startIndex + i + 1];
  76.             }
  77.         }
  78.         catch(ArrayIndexOutOfBoundsException ex)
  79.         {
  80.             throw new MissingArgumentsException(args[startIndex]);
  81.         }
  82.         
  83.         return (array);
  84.     }
  85. }
  86.  
  87.